#ifndef SIMPLEAPP1_H_
#define SIMPLEAPP1_H_

#include "CEGuiD3D10BaseApplication.h"
#include <D3DX10.h>

struct SimpleVertex
{
    D3DXVECTOR3 Pos;  // Position
};

class SimpleApp: public CEGuiD3D10BaseApplication
{
public:

    HRESULT createScene()
    {
        HRESULT hr = S_OK;

        bvRenderer = new BvD3D10Renderer(pimpl->d_device);

        SubMesh sb;
        sb.eftId = bvRenderer->addEffect("SimpleShader.fx");
        sb.techName = "Render";

        D3D10_PASS_DESC PassDesc;
        bvRenderer->GetTechniquePassByIndexDesc(&PassDesc, sb.eftId, sb.techName, 0);
        FormatDesc fd = {0, TYPE_VERTEX, FORMAT_FLOAT, 3};
        sb.vfId = bvRenderer->addVertexFormat(&fd, 1, &PassDesc);
        bvRenderer->setVertexFormat(sb.vfId);

        SimpleVertex vertices[] =
        {
            D3DXVECTOR3( 0.0f, 0.5f, 0.5f ),
            D3DXVECTOR3( 0.5f, -0.5f, 0.5f ),
            D3DXVECTOR3( -0.5f, -0.5f, 0.5f ),
        };
        sb.vbId = bvRenderer->addVertexBuffer(vertices, sizeof(vertices));
        bvRenderer->addSubMesh(sb);
        bvRenderer->setVertexBuffer(0, sb.vfId, sb.vbId, 0);

        return hr;
    }


    void drawPerFrame()
    {
        bvRenderer->drawMeshes(PRIM_TRIANGLES, 0, 0, 3, 0);
        //bvRenderer->drawMeshes(PRIM_TRIANGLES, 36, 0, 8, 0);
    }


};

#endif
